package org.ipower.examsystem.service.impl;

import java.util.List;
import org.ipower.examsystem.dao.ClientShortcutDao;
import org.ipower.examsystem.domain.ClientShortcut;
import org.ipower.examsystem.service.ClientShortcutService;
import org.ipower.platform.domain.Pager;
import org.ipower.platform.domain.QueryCondition;

/**
 * 客户端快捷方式服务实现类。
 * @author jeasonyoung
 */
public class ClientShortcutServiceImpl implements ClientShortcutService {
    private ClientShortcutDao dao = null;
  
    @Override
    public void setClientShortcutDao(ClientShortcutDao dao) {
       this.dao = dao;
    }
  
    @Override
    public Pager<ClientShortcut> findAll(String ascProperty, boolean isAsc, int start, int limit, List<QueryCondition> entites) {
       return this.dao.findAll(ascProperty, isAsc, start, limit, entites);
    }
     
    @Override
    public void saveOrUpdate(ClientShortcut data) {
       if(data != null && data.getShortcutID() != null && !data.getShortcutID().isEmpty()){
            if(this.dao.load(data.getShortcutID()) == null){
                this.dao.save(data);
            }else{
                this.dao.update(data);
            }
       }
    }

    @Override
    public void delete(String shortcutID) {
        if(shortcutID != null && !shortcutID.isEmpty()){
            this.dao.delete(shortcutID);
        }
    }
}